<?php
use Workerman\Worker;
use Workerman\Connection\AsyncTcpConnection;
require_once __DIR__ . '/vendor/autoload.php';

$worker = new Worker();

$worker->onWorkerStart = function($worker){
    $con = new AsyncTcpConnection('ws://127.0.0.1:2000');
    $con->onConnect = function($con) {
        echo "HuobiClientWorker: Connect";
        $con->send('client connect notice');
    };
    $con->onMessage = function($con, $data) {
        echo $data;
        //$con->send('hello');
    };
    $con->onClose= function($con) {
        echo "HuobiClientWorker: Close";
    };

    $con->connect();
};

Worker::runAll();